package com.union.core.complain.service;

import java.util.List;

import org.apache.log4j.Logger;

import com.union.core.complain.dao.ComplainDao;
import com.union.core.complain.dao.impl.ComplainDaoImpl;
import com.union.core.complain.model.Complain;

public class ComplainService{
	
	private static Logger log = Logger.getLogger(ComplainService.class.getName());
	private ComplainDao complainDaoImpl;
	
	public ComplainService(){
		complainDaoImpl = new ComplainDaoImpl();
	}
	
	public List<Complain> queryList(int complain_id,String complain_name,String complain_content,int organization_id,String organization_name,String join_date1,
			String join_date2,String complain_phone,String add_time,int ishandle,String paramName, String paramValue, String orderByName,int start,int pageSize){
		List<Complain> complainList = complainDaoImpl.queryList(complain_id, complain_name, complain_content, organization_id,organization_name,join_date1, join_date2, complain_phone, add_time,ishandle,paramName, paramValue, orderByName, start, pageSize);
		log.info("PLAT 查询公告信息：complain_id="+complain_id+",complain_name="+complain_name+",complain_content="+complain_content+",organization_id="+organization_id+",organization_name="+organization_name
				+ ",join_date1="+join_date1+",join_date2="+join_date2+",complain_phone="+complain_phone+",add_time="+add_time
				+ ",paramName="+paramName+",paramValue="+paramValue+",orderByName="+orderByName
				+ ",start="+start+",pageSize="+pageSize);
		return complainList;
	}
	

	public int quertListCount(int complain_id,String complain_name,String complain_content,int organization_id,String organization_name,String join_date1,
			String join_date2,String complain_phone,String add_time,int ishandle,String paramName, String paramValue){
		int count = complainDaoImpl.quertListCount(complain_id, complain_name, complain_content,organization_id,organization_name, 
				join_date1, join_date2, complain_phone, add_time, ishandle,paramName, paramValue);
		log.info("PLAT 查询多条公告信息：count="+count+",complain_id="+complain_id+",complain_name="+complain_name+",complain_content="+complain_content+",organization_id="+organization_id+",organization_name="+organization_name
				+ ",join_date1="+join_date1+",join_date2="+join_date2+",complain_phone="+complain_phone+",add_time="+add_time
				+ ",paramName="+paramName+",paramValue="+paramValue);
		return count;
	}
	
	/**
	 * 
	 * @param Complain_id
	 * @return
	 */
	public Complain query(int complain_id){
		Complain complain = complainDaoImpl.query(complain_id);
    	log.info("PLAT: 查询公告信息: "+complain.getComplain_id());
    	return complain;
	}
	
	/**
	 * 
	 * @param Complain
	 * @return
	 */
	public void add(Complain complain){
		complainDaoImpl.add(complain);
		log.info("PLAT: 添加查询公告信息: "+complain.getComplain_name());
	}
	
	/**
	 * 
	 * @param Complain
	 * @return
	 */
	public boolean edit(Complain complain){
		boolean bl=false;
		bl=complainDaoImpl.edit(complain);
		log.info("PLAT: 修改查询公告信息: "+complain.getComplain_id());
		return bl;
	}
	
	/**
	 * 
	 * @param Complain_id
	 * @return
	 */
	public void delete(int complain_id){
		complainDaoImpl.delete(complain_id);
		log.info("PLAT: 修改查询公告信息: complain_id="+complain_id);
	}
}